//
//  UIButton+Extension.swift
//  weibo
//
//  Created by apple on 16/2/20.
//  Copyright © 2016年 apple. All rights reserved.
//

import UIKit

extension UIButton{
    //    button 扩展一个构造函数
    //  1.背景图片 + 图片

    convenience init(backImageName: String,imageName: String) {
        self.init()
        setBackgroundImage(UIImage(named: backImageName), forState: .Normal)
        setImage(UIImage(named: imageName), forState: .Normal)
        
        //设置高亮
        setBackgroundImage(UIImage(named: backImageName + "_highlighted"), forState: .Highlighted)
        setImage(UIImage(named: imageName + "_highlighted"), forState: .Highlighted)
    }
    
    //2.背景图片 + 文案
    convenience init(backImageName: String,title: String,textColor: UIColor) {
        self.init()
        setBackgroundImage(UIImage(named: backImageName), forState: .Normal)
        setTitle(title, forState: .Normal)
        setTitleColor(textColor, forState: .Normal)
    }

}

